package com.num2.controller.scf;

import javax.annotation.Resource;

import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;

import com.num2.form.scf.Transaction_recordForm;
import com.num2.model.scf.Transaction_recordModel;
import com.num2.service.scf.Transaction_recordService;


@Controller
public class Transaction_recordCtrl {
	@Resource
	private Transaction_recordService transaction_recordService;

	@RequestMapping("/check")
	public String Check(Transaction_recordForm transaction_recordForm, Model m) {
		System.out.println("进来了。。。");
		Transaction_recordModel transaction_recordModel = transaction_recordService
				.check(transaction_recordForm);
		if (transaction_recordModel != null) {
			m.addAttribute("transaction_id",
					transaction_recordModel.getTransaction_id());
			m.addAttribute("transaction_date",
					transaction_recordModel.getTransaction_date());
			m.addAttribute("remark", transaction_recordModel.getRemark());
			m.addAttribute("income_expend",
					transaction_recordModel.getIncome_expend());
			m.addAttribute("currency", transaction_recordModel.getCurrency());
			m.addAttribute("balance", transaction_recordModel.getBalance());
			m.addAttribute("other_account",
					transaction_recordModel.getOther_account());
			System.out.println(transaction_recordModel.getRemark());
			return "transaction";
		} else {
			return "error";
		}
	}

	public Transaction_recordService getTransaction_recordService() {
		return transaction_recordService;
	}

	public void setTransaction_recordService(
			Transaction_recordService transaction_recordService) {
		this.transaction_recordService = transaction_recordService;
	}
}